package com.bjpowernode.boss.convert;

import com.bjpowernode.boss.mvc.models.vo.PayProductVo;
import com.bjpowernode.boss.mvc.models.vo.PayWayVo;
import com.bjpowernode.boss.persist.domain.PayProduct;
import com.bjpowernode.boss.persist.domain.PayWay;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingConstants;
import org.mapstruct.Mappings;

import java.util.List;

@Mapper(componentModel = MappingConstants.ComponentModel.SPRING,
        uses = {CommonFun.class})
public interface PaymentConvert {

    @Mappings({
            @Mapping( target = "status", source = "status", qualifiedByName = "translateStatus"),
            @Mapping(target = "editTime", source = "editTime", dateFormat = "yyyy-MM-dd HH:mm:ss")
    })
    PayProductVo payProductToVo(PayProduct payProduct);

    List<PayProductVo> payProductListToVoList(List<PayProduct> payProductList);

    @Mappings({
            @Mapping(target = "productCode",source = "payProductCode"),
            @Mapping(target = "status", source = "status", qualifiedByName = "translateStatus"),
            @Mapping(target = "editTime", source = "editTime", dateFormat = "yyyy-MM-dd HH:mm:ss")
    })
    PayWayVo payWayToVo(PayWay payWay);

    List<PayWayVo> payWayListToVoList(List<PayWay> payWayList);
}
